//
//  ViewController.m
//  28-HomeWork-LaGouAnimation
//
//  Created by dllo on 16/8/22.
//  Copyright © 2016年 DM.C. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *lagouImageView;
@property (weak, nonatomic) IBOutlet UIButton *userButton;
@property (weak, nonatomic) IBOutlet UIButton *passwordButton;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layout_user_width40;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layout_password_width_40;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layout_user_width1;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layout_password_width1;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layout_view_width1;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layout_view_width274;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layout_register_left30;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layout_rigister_left344;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layout_leftView_left10;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layout_rightView_right10;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layout_leftView_left160;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layout_rightView_right160;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layout_register_right30;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layout_register_right175;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.lagouImageView.transform = CGAffineTransformMakeTranslation(0, -300);
    
    NSLog(@"%f", self.view.frame.size.width);
}
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    // 改变两个button的宽的优先级
    self.layout_user_width1.priority = 750;
    self.layout_user_width40.priority = 751;
    self.layout_password_width1.priority = 750;
    self.layout_password_width_40.priority = 751;
    // 改变view的宽的优先级
    self.layout_view_width1.priority = 750;
    self.layout_view_width274.priority = 751;
    // 改变登录按钮据左边的优先级
    self.layout_register_left30.priority = 751;
    self.layout_rigister_left344.priority = 750;
    // 改变登入按钮右边的优先级
    self.layout_register_right30.priority = 751;
    self.layout_register_right175.priority = 750;
    // 改变or两边view的优先级
    self.layout_leftView_left10.priority = 751;
    self.layout_leftView_left160.priority = 750;
    self.layout_rightView_right10.priority = 751;
    self.layout_rightView_right160.priority = 750;
    // 设置动画
    [UIView animateWithDuration:3 delay:0 options:UIViewAnimationOptionRepeat  animations:^{
        // 设置拉钩的动画
        self.lagouImageView.transform = CGAffineTransformIdentity;
        // 设置用户和密码两个button的动画
        [self.view layoutIfNeeded];
        
    } completion:^(BOOL finished) {
        
    }];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
